# while 循环
# 打印 5 遍 Hello
i = 1
while i <= 2:
    print("Hello!")
    i = i + 1

print(f"循环结束，i 的值为：{i}")



print("\n --------- 计算 0~100 之间所有数字的累计求和 ---------")
index = 0
sum = 0
while index <= 100:
    sum += index
    index += 1

print(f"0~100 之间的和为：{sum}，index 的值为：{index}")



print("\n --------- 计算 0~100 之间所有偶数的累计求和 ---------")
index = 0
sum = 0
while index <= 100:
    if index % 2 == 0:
        sum += index
    index += 1

print(f"0~100 之间的所有偶数的和为：{sum}，index 的值为：{index}")



print("-- 在控制台连续输出 5 行 ‘*’ ；每一行 ‘*’ 连续增加")
index = 5
row = 1
while row <= index:
    print('*' * row)
    row += 1

print("-- 循环嵌套：在控制台连续输出 5 行 ‘*’ ；每一行 ‘*’ 连续增加")
index = 5
row = 1
while row <= index:
    column = 1
    while column <= row:
        print('*', end='')
        column += 1
    print()
    row += 1



print("九九乘法表")
maxVal = 9

row = 1
while row <= maxVal:
    col = 1
    while col <= row:
        print(f"{col}*{row}={col * row}", end="\t")
        col += 1
    row += 1
    print()